<template>
  <a-form :form="form">
   
    <a-form-item
      :label-col="formItemLayout.labelCol"
      :wrapper-col="formItemLayout.wrapperCol"
      label="运输状态"
    >
      <a-select
        v-decorator="[
          'lv',
          { rules: [{ required: true, message: '请选择权限等级' }] },
        ]"
      >
        <a-select-option :value="1">运输中</a-select-option>
        <a-select-option :value="2">未发货</a-select-option>
      </a-select>
    </a-form-item>
   
    <a-form-item :label-col="formTailLayout.labelCol" :wrapper-col="formTailLayout.wrapperCol">
      <a-button  :loading="btnLoading" type="" @click="check">
        确认修改
      </a-button>
    </a-form-item>
  </a-form>
</template>

<script>
import { post } from '../../../../utils/request';
import { message } from 'ant-design-vue';
// import { post } from './../../../../utils/request';
// import { jm } from './../../../../utils/safe';

const formItemLayout = {
  labelCol: { span: 8 },
  wrapperCol: { span: 12 },
};
const formTailLayout = {
  labelCol: { span: 4 },
  wrapperCol: { span: 8, offset: 4 },
};
export default {
  data() {
    return {
      checkNick: false,
      formItemLayout,
      formTailLayout,
      btnLoading: false,
      form: this.$form.createForm(this, { name: 'dynamic_rule' }),
    };
  },
  props: ['fn','ordernumber','getdataList'],
  methods: {
    check() {
      console.log('getFieldsValue', this.form.getFieldsValue());
      this.form.validateFields((err,value) => {
        if (!err) {
          console.info('success');
          console.log("value",value);
          const params = this.form.getFieldsValue();
          delete params.enterpassword;
          this.btnLoading = true;
          console.log(this.ordernumber);
          post('/user/changetags',{
            ...this.ordernumber,
            tags:value.lv=== 1 ? "运输中" : "未发货",
          }).then(() => {
            message.success('修改成功！');
            this.fn(false);
            this.getdataList();
          })
            .finally(()=>{
                this.btnLoading = false;
            })
          // post('/user/createUser', params)
          //   .then(()=>{
          //       message.success('添加成功！');
          //       this.addModelContrulor(false);
          //       this.$bus.$emit('search', null);
          //   })
          //   .finally(()=>{
          //       this.btnLoading = false;
          //   })
        }
      });
    },
    // 
    
  },
};
</script>